import React, { Component, Fragment } from 'react';
import {  Form,Spin, Icon } from 'antd';
import { connect } from 'dva';
import { formatMessage } from 'umi-plugin-react/locale';
import moment from 'moment';
import router from 'umi/router';
import EditPage from '@/components/EditPage';
import DetailPage from '@/components/DetailPage';
import { transferLanguage, } from '@/utils/utils';
import {formItemFragement} from '@/utils/common'
import {
  selectExportOSList,
} from './utils';
@connect(({ myOrder, component, loading ,i18n}) => ({
  myOrder,
  KNTracksOne: myOrder.KNTracksOne,
  language:i18n.language
}))
export default class OrderAnalysisTable extends Component {
  constructor(props) {
    super(props);
    this.state = {
      detail: {},
    };
  }
  componentDidMount() {
    this.getDetail();
  }

  getDetail(id) {
    const {selectKNTracksOne,detailId,dispatch} = this.props;
    console.log('detailId---',detailId)
    dispatch({
      type:'myOrder/getTrackingOne',
      payload:{kangNingOrderNo:this.props.detailId},
      callback:(res)=>{
      }
    })
  }

  render() {
    const {KNTracksOne,language}=this.props;
    const detail =KNTracksOne||{};
    const basic=transferLanguage('form.button.BasicInformation',language)
    const editPageParams = {
      panelValue: [{ 
        //key: '基础信息'
        key:basic
       // key:formatMessage({id:'form.button.basicInformation'})
       }],
    };

    const formItem = [
      [
        <DetailPage label={transferLanguage('Analysis.field.OrderNo',this.props.language)} value={detail['kangNingOrderNo']} />,
        <DetailPage label={transferLanguage('Analysis.field.OrderType',this.props.language)} value={detail['orderType']} />,
      ],
      [
        <DetailPage label={transferLanguage('Analysis.field.Status',this.props.language)} value={detail['status']} />,
        <DetailPage label={transferLanguage('Analysis.field.DeliveryNo',this.props.language)} value={detail['exportOrderNo']} />,
      ],
      [
        <DetailPage label={transferLanguage('Analysis.field.PlannedShipOut',this.props.language)} value={detail['requiredDelivery']} />,
        // <DetailPage label={transferLanguage('Analysis.field.ActualShipOut',this.props.language)} value={detail['Actual Ship out']} />,
      ],
      [
        <DetailPage label={transferLanguage('Analysis.field.TransportationNo',this.props.language)} value={detail['transportOrderNo']} />,
        <DetailPage label={transferLanguage('Analysis.field.OrderCreated',this.props.language)} value={detail['orderTime']} />,
      ],
      // [
      //   <DetailPage label={transferLanguage('Analysis.field.PickingCompleted',this.props.language)} value={detail['Picking completed']} />,
      //   <DetailPage label={transferLanguage('Analysis.field.PackingCompleted',this.props.language)} value={detail['Packing completed']} />,
      // ],
      [
        <DetailPage label={transferLanguage('Analysis.field.PickupAddress',this.props.language)} value={detail['pickPlace']} />,
        <DetailPage label={transferLanguage('Analysis.field.Receiver',this.props.language)} value={detail['receiver']} />,
      ],
      [
        <DetailPage label={transferLanguage('Analysis.field.ShipToAddress',this.props.language)} value={detail['receivePlace']} />,
        <DetailPage label={transferLanguage('Analysis.field.PlannedArrivalTime',this.props.language)} value={detail['requiredArrivalTime']} />,
      ],
    ];

    return (
      <EditPage {...editPageParams}>
        <Spin spinning={false}>{formItemFragement(formItem)}</Spin>
      </EditPage>
    );
  }
}
